﻿using System.ServiceModel;
using ChatForum.DataContract;
using System.Collections.Generic;
using System.ServiceModel.Web;
using System;

namespace ChatForum.REST.ServiceContract
{
	[ServiceContract]
	public interface IForumService
    {
        #region /categories
        [OperationContract]
		[FaultContract(typeof(string))]
		[WebGet(UriTemplate = "/categories")]
		IEnumerable<CategoryDTO> GetAllCategory();

		[OperationContract]
		[FaultContract(typeof(string))]
		[WebInvoke(Method = "POST", UriTemplate = "/categories")]
		void CreateCategory(CategoryDTO category);

		[OperationContract]
		[FaultContract(typeof(string))]
		[WebInvoke(Method = "PUT", UriTemplate = "/categories")]
		void ModifyAllCategory(IEnumerable<CategoryDTO> categoryCollection);

		[OperationContract]
		[FaultContract(typeof(string))]
		[WebInvoke(Method = "DELETE", UriTemplate = "/categories")]
		void DeleteAllCategory();

		[OperationContract]
		[FaultContract(typeof(string))]
		[WebGet(UriTemplate = "/categories/{categoryTitle}")]
		CategoryDTO GetCategory(string categoryTitle);

		[OperationContract]
		[FaultContract(typeof(string))]
		[WebInvoke(Method = "PUT", UriTemplate = "/categories/{categoryTitle}")]
		void ModifyCategory(string categoryTitle, CategoryDTO category);

		[OperationContract]
		[FaultContract(typeof(string))]
		[WebInvoke(Method = "DELETE", UriTemplate = "/categories/{categoryTitle}")]
		void DeleteCategory(string categoryTitle);
        #endregion Category

        #region /categories/{categorytitle}/thread
        [OperationContract]
        [FaultContract(typeof(string))]
        [WebGet(UriTemplate = "/categories/{categorytitle}/thread")]
        IEnumerable<ThreadDTO> GetAllThread_Category(string categoryTitle);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "POST", UriTemplate = "/categories/{categorytitle}/thread")]
        void CreateThread_Category(string categoryTitle, PostDTO post);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "PUT", UriTemplate = "/categories/{categorytitle}/thread")]
        void ModifyAllThread_Category(string categoryTitle, IEnumerable<PostDTO> threadCollection);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "DELETE", UriTemplate = "/categories/{categorytitle}/thread")]
        void DeleteAllThread_Category(string categoryTitle);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebGet(UriTemplate = "/categories/{categorytitle}/thread?postId={postId}")]
        IEnumerable<PostDTO> GetThread_Category(string categoryTitle, Guid postId);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "POST", UriTemplate = "/categories/{categorytitle}/thread?postId={postId}")]
        void PostThread_Category(string categoryTitle, Guid postId, PostDTO post);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "PUT", UriTemplate = "/categories/{categorytitle}/thread?postId={postId}")]
        void ModifyThread_Category(string categoryTitle, Guid postId, IEnumerable<PostDTO> thread);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "DELETE", UriTemplate = "/categories/{categorytitle}/thread?postId={postId}")]
        void DeleteThread_Category(string categoryTitle, Guid postId);
        #endregion

        #region /categories/{categorytitle}/posts
        [OperationContract]
        [FaultContract(typeof(string))]
        [WebGet(UriTemplate = "/categories/{categorytitle}/posts")]
        IEnumerable<PostDTO> GetAllPost_Category(string categoryTitle);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "POST", UriTemplate = "/categories/{categorytitle}/posts")]
        void CreatePost_Category(string categoryTitle, PostDTO post);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "PUT", UriTemplate = "/categories/{categorytitle}/posts")]
        void ModifyAllPost_Category(string categoryTitle, IEnumerable<PostDTO> postCollection);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "DELETE", UriTemplate = "/categories/{categorytitle}/posts")]
        void DeleteAllPost_Category(string categoryTitle);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebGet(UriTemplate = "/categories/{categorytitle}/posts?postId={postId}")]
        PostDTO GetPost_Category(string categoryTitle, Guid postId);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "PUT", UriTemplate = "/categories/{categorytitle}/posts?postId={postId}")]
        void ModifyPost_Category(string categoryTitle, Guid postId, PostDTO post);

        [OperationContract]
        [FaultContract(typeof(string))]
        [WebInvoke(Method = "DELETE", UriTemplate = "/categories/{categorytitle}/posts?postId={postId}")]
        void DeletePost_Category(string categoryTitle, Guid postId);
        #endregion
    }
}
